<?php
session_cache_expire(999999999);
if (!isset($_SESSION)) {
    session_start();
}
if (!isset($_SESSION['db'])) {
    $addressbrowser = $_SERVER['SERVER_NAME'];
    $temp = explode(".", $addressbrowser);
    $connection = mysql_connect("1.234.53.52", "cam", "5678");
    //$connection = mysql_connect("localhost", "root", "root" ) ;
    mysql_select_db("elihan", $connection);
    mysql_query("set names 'utf8'");
    $selectdatabase = mysql_query("SELECT am.DatabaseName,am.Logo from ac_eli_manager am where am.KeyName='$temp[0]' and am.`Status` = 2");
    $result = mysql_fetch_assoc($selectdatabase);

    $_SESSION['Logo'] = $result['Logo'];
    $_SESSION['db'] = $result['DatabaseName'];
    mysql_close($connection);
}
$database = $_SESSION['db'];
if($_SESSION['role']!=3){
	header('Location: index.php');
}
?>
<script
src="js/jquery.treeview.js" type="text/javascript"></script>
<script type="text/javascript">
    function menuEffect(ele){
        if($(ele).find('div').hasClass('collapsable-hitarea')){
            ajaxMenu('hide', $(ele).find('div').attr('id'));
            $(ele).find('div').removeClass('collapsable-hitarea');
            $(ele).find('div').addClass('expandable-hitarea');					
            $(ele).parent().find('ul:first').toggle();
        }else{
            ajaxMenu('show', $(ele).find('div').attr('id'));
            $(ele).find('div').removeClass('expandable-hitarea');
            $(ele).find('div').addClass('collapsable-hitarea');
            $(ele).parent().find('ul:first').toggle();
        }
    }
	
    function ajaxMenu(action,menuid){
        $.ajax({url:"ajax/ajaxmenuadmin.php", data : {actions : action , menuid : menuid}});
    }
		
</script>
<link
    rel="stylesheet" type="text/css" href="css/menu.css" />
<style>
    * {
        font-family: verdana;
    }

    #fade { /*--Transparent background layer--*/
        display: none; /*--hidden by default--*/
        /*background: #000;*/
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        opacity: .80;
        z-index: 9999;
    }

    .popup_block {
        display: none; /*--hidden by default--*/
        background: #fff;
        border: 1px solid silver;
        float: left;
        font-size: 1.2em;
        position: fixed;
        top: 50%;
        left: 50%;
        z-index: 99999;
        /*--CSS3 Box Shadows--*/
        /*--CSS3 Rounded Corners--*/
    }

    .btn_close {
        float: right;
        margin: 5px 5px 0 0;
        color: white;
        font-weight: bold;
    }
    /*--Making IE6 Understand Fixed Positioning--*/
    * html #fade {
        position: absolute;
    }

    * html .popup_block {
        position: absolute;
    }

    .btnupbg {
        background: #309dcf;
        border-radius: 3px;
        color: white;
        cursor: pointer;
        font-weight: bold;
        height: 25px;
        padding: 0 5px 0;
        border-color: #C4C0B9;
        border-width: 1px;
        margin-right: 5px
    }

    .btnupbg:hover {
        background: #686868
    }

    .btnupload {
        background: -moz-linear-gradient(center top, #63B6DB, #309DCF) repeat;
    }
</style>
<script>
    $(document).ready(function(){
                                                                      
        //When you click on a link with class of poplight and the href starts with a # 
        $('a.poplight[href^=#]').click(function() {
            var popID = $(this).attr('rel'); //Get Popup Name
            var popURL = $(this).attr('href'); //Get Popup href to define size
                                
            //Pull Query & Variables from href URL
            var query= popURL.split('?');
            var dim= query[1].split('&');
            var popWidth = dim[0].split('=')[1]; //Gets the first query string value
 
            //Fade in the Popup and add close button
            $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><span class="btn_close">X</span></a>');
                
            //Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
            var popMargTop = ($('#' + popID).height() + 80) / 2;
            var popMargLeft = ($('#' + popID).width() + 80) / 2;
                
            //Apply Margin to Popup
            $('#' + popID).css({ 
                'margin-top' : -popMargTop,
                'margin-left' : -popMargLeft
            });
                
            //Fade in Background
            $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
            $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
                
            return false;
        });
        
        
        //Close Popups and Fade Layer
        $('a.close, #fade, .iclose').live('click', function() { //When clicking on the close or fade layer...
            $('#fade , .popup_block').fadeOut(function() {
                $('#fade, a.close').remove();  
            }); //fade them both out
                
            return false;
        });
 
        
    });
</script>
<div id="menuvar" style="">
    <div id="sidetree" style="width:250px">

        <ul id="tree" class="treeview">
            <li class="roots"><img src="images/index_06.png" alt="" /><span> <a
                        class="huyngo" style="color: white; font-weight: bold;"
                        href="partnermanage.php"><?= $l_partnermanage ?> </a> </span></li>
        </ul>
    </div>
</div>
